package cn.zysuyuan.common.entity;

import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * @author flypig
 * @version 1.0
 * @date 2019/10/27 19:58
 */
public class PageResult<T> {

    private Long total;
    private Integer totalPage;
    private List<T> rows;

    public PageResult() {
    }

    public PageResult(List<T> rows) {
        this.rows = rows;
        PageInfo pageInfo = new PageInfo(rows);
        this.total = pageInfo.getTotal();
    }

    public PageResult(Long total, List<T> rows) {
        this.total = total;
        this.rows = rows;
    }

    public PageResult(Long total, Integer totalPage, List<T> rows) {
        this.total = total;
        this.totalPage = totalPage;
        this.rows = rows;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }
}
